/**
 * 苗木列表
 * Created by Wayne on 2015/7/17.
 */
 define(function(require, exports, module) {
	'use strict';
	module.exports = function(app) {
		app.register.controller('recordCtrl', ['$scope', '$location', 'tempData', 'MHService', '$routeParams',
			function($scope, $location, tempData, MHService, $routeParams) {
				var toast = require('../services/mh-toast');
				// console.log($routeParams['resolveid']);
				// console.log( $routeParams.rName)
				$scope.recordName = $routeParams.rName;
				var config = {
					url: MHService.URL.record_list +'?id='+ $routeParams['resolveid']
				}
				MHService.pageQuery(config, function(data) {
					// console.log(data.data);
					$scope.records =data.data;
				})

				$scope.showRecord = function(index) {
					if($scope.show!=index) {
						$scope.show = index;
					} else {
						$scope.show = undefined;
					}
				}
				$scope.fillout = function(index) {
					$scope.records[index].rName = $routeParams.rName
					tempData.data = $scope.records[index];
					$location.path('/filloutRecord');
				}
			}
		])
	}
})